#ifndef _EMPLOYER_H_
#define _EMPLOYER_H_

#include <iostream>
#include <string>
#include <fstream>

using namespace std;

class Employer {
  friend ostream& operator<<              // This has to be a friend 
    (ostream& out, const Employer& empr); // so it can access non-
public:                                    // public members
  Employer( ) {}
  ~Employer( ) {}

  void setName(const string& name) {name_ = name;}
private:
  string name_;
};

class Employee {
  friend ostream& operator<<
    (ostream& out, const Employee& obj); 
public:
  Employee( ) : empr_(NULL) {}
  ~Employee( ) {if (empr_) delete empr_;}

  void setFirstName(const string& name) {firstName_ = name;}
  void setLastName(const string& name) {lastName_ = name;}
  // This example is taken from C++ cookbook
  // It was wrong 
  //wrong  void setEmployer(Employer& empr) {empr_ = &empr;}
  void setEmployer(const Employer& empr) {empr_ = new Employer(empr);}
  const Employer* getEmployer( ) const {return(empr_);}
  
private:
  string firstName_;
  string lastName_;
  Employer* empr_;
};

#endif // _EMPLOYER_H_

// eof
